package com.tangyuan.model;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

/**
 * @Description: ty_finance
 * @Author: jeecg-boot
 * @Date:   2024-03-24
 * @Version: V1.0
 */
@Data
@TableName("ty_finance")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="ty_finance对象", description="ty_finance")
public class TyFinance implements Serializable {
    private static final long serialVersionUID = 1L;

	/**id*/
	@TableId(type = IdType.AUTO)
    @ApiModelProperty(value = "id")
    private Long id;
	/**用户id*/
    @ApiModelProperty(value = "用户id")
    private Long userId;
	/**订单号*/
    @ApiModelProperty(value = "订单号")
    private String orderNo;
	/**订单总额*/
    @ApiModelProperty(value = "订单总额")
    private BigDecimal totalAmount;
	/**支付来源 1 微信 2 支付宝 3 余额 4-ios*/
    @ApiModelProperty(value = "支付来源 1 微信 2 支付宝 3 余额 4-ios")
    private Integer payWay;
	/**1-等待中 2-成功 3-已退款*/
    @ApiModelProperty(value = "1-等待中 2-成功 3-已退款")
    private Integer status;
	/**创建时间*/
	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "创建时间")
    private Date createTime;
	/**修改时间*/
	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "修改时间")
    private Date updateTime;
	/**付款时间*/
	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "付款时间")
    private Date payTime;
	/**1-客户付款 3-退款 4-提现*/
    @ApiModelProperty(value = "1-客户付款 3-退款 4-提现")
    private Integer type;
	/**交易号*/
    @ApiModelProperty(value = "交易号")
    private String transactionId;
	/**手续费*/
    @ApiModelProperty(value = "手续费")
    private BigDecimal chargePrice;
	/**退款时间*/
	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "退款时间")
    private Date refundTime;
	/**是否删除*/
    @ApiModelProperty(value = "是否删除")
    @TableLogic
    private Integer isDel;

    @TableField(exist = false)
    private String productId;
    public boolean isEmpty() {
        return id == null
                && userId == null
                && (orderNo == null || orderNo.isEmpty())
                && totalAmount == null
                && payWay == null
                && status == null
                && createTime == null
                && updateTime == null
                && payTime == null
                && type == null
                && (transactionId == null || transactionId.isEmpty())
                && chargePrice == null
                && refundTime == null
                && (isDel == null || isDel == 0); // 假设0表示未删除，可根据实际情况调整
    }
}
